
    <div class="content margin_top">
        <header class="header fixed_top bg_mx_green"></header>
        <form class="vaccine"></form>
    </div>
    <div class="toast"></div>
    <!-- toast模版 -->
    <script type="text/template" charset="utf-8" id='toast_template'>
        <i class="iconfont icon-toast{{=it.icon}}"></i>
        <div class="toast_text">{{=it.text}}</div>
    </script>
    <script type="text/template" charset="utf-8" id='info_template'>
        <div class="bg_white margin_b_10">

            <div class="padding_10_15 v_center border_b">
                <div class="width_70">疫苗类型</div>
                <div class="left_50">
                    <input type="text" name="vaccinename" value="<{$vaccine['vaccinename']}>" readonly>
                    <input type="hidden" name="vaccineid" value="<{$vaccine['id']}>" readonly>
                </div>
            </div>
            <div class="padding_10_15">
                <textarea name="remark" rows="5" placeholder="请输入疫苗情况描述" title="疫苗情况描述"></textarea>
            </div>
        </div>
        <div class="padding_15 font_16">
            <button class="btn btn_mx_green all_width lineheight_3">保存</button>
        </div>
        <input name="_csrf" type="hidden" id="_csrf" value="<{$app->request->csrfToken}>">
        <input type="hidden" name="pigid">

        <div class="padding_h_15 font_12 light" style="color:#000;">
            <{foreach $varecords as $key => $row}>
            <div class="h_justify border_b" style="margin-bottom: 15px">
                <div><b>疫苗类型</b></div>
                <div><b>计划疫苗时间</b></div>
                <div><b>实际疫苗时间</b></div>
                <div><b>状态</b></div>
            </div>
            <div class="h_justify border_b" style="margin-bottom: 15px">
                <div><{$row['vaccinename']}></div>
                <div><{date('Y-m-d',$row['shoulddate'])}></div>
                <div><{date('Y-m-d',$row['date'])}></div>
                <div>未防疫</div>
            </div>
            <{/foreach}>
        </div>

        </div>
    </script>
    <script type="text/template" charset="utf-8" id='img_template'></script>
    <script>
        // 页面初始化
            var evalinfo = doT.template($("#info_template").text());
            var evalToast = doT.template($("#toast_template").text());
            var date_now = new Date();
            var d = date_now.getFullYear()+'-'+f(date_now.getMonth()+1)+'-'+f(date_now.getDate());
            loaddata(".vaccine",evalinfo,d);
            loadheadbar("添加疫苗情况",1)
        // 提交表单
            var submited = false;
            $(".vaccine").submit(function(e){
                e.preventDefault();
                var pigid = GetQueryString("pigid");
                $("input[name=pigid]").val(pigid)
                with(this){
                    for (var i = 0; i < this.length; i++) {
                        if($(this[i]).attr("request")==""){
                            if(!checkone(this[i])){
                                return false;
                            }
                        }
                    }
                    if(submited) return false;
                    var data = $(".vaccine").serialize();
                    $.post("/business/person/post-vaccine",data,function(res){console.log(res)
                        submited = true;
                        toast("attention",res.msg);
                        if(res.status == 0){
                            location.href='/business/person/pig';
                        }
                    },"json")
                }
            })
    </script>


